using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class News_EditNews : PageBase
{
    #region ResetAdapter
    protected override void OnPreInit(EventArgs e)
    {
        HttpContext.Current.Request.Browser.
            Adapters["System.Web.UI.WebControls.DetailsView, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"]
            = "SiteECSWeb.DetailsViewAdapterReset";
        base.OnPreInit(e);
    }
    protected override void OnUnload(EventArgs e)
    {
        base.OnUnload(e);
        HttpContext.Current.Request.Browser.
           Adapters["System.Web.UI.WebControls.DetailsView, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"]
           = "CSSFriendly.DetailsViewAdapter";
    }
    #endregion

    int NewsID;

    protected void Page_Load(object sender, EventArgs e)
    {
        #region SiteMap
        Helper.BuildDynamicSiteMap("News",
            Globals.Settings.VirtualNamesInfo.NewsArchive, true, "News One",
            Globals.Settings.VirtualNamesInfo.NewsDetails,
            string.Empty,
            Globals.Settings.VirtualNamesInfo.NewsEdit,
            Globals.Settings.VirtualNamesInfo.NewsReport,
            false);
        this.SiteMapNodeProvider = SiteMapProviderNames.DynamicSiteMapProvider.ToString();
        SiteMapPath1.SiteMapProvider = SiteMapNodeProvider;
        #endregion
    }
    protected void NewsDataSource_Selecting
       (object sender, ObjectDataSourceSelectingEventArgs e)
    {
        if (Helper.CheckAndGetQueryStringInt("NewsID",
            Globals.Settings.VirtualNamesInfo.NewsEdit, out NewsID))
        {
            e.InputParameters["News_id"] = NewsID.ToString();
        }
    }
    protected void NewsDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        if (DetailsView1.CurrentMode == DetailsViewMode.Edit)
        {
            UControlsBase_CascadingDropList cddlCountryName =
                DetailsView1.FindControl("cddlCountryName") as UControlsBase_CascadingDropList;            
            e.InputParameters["Cuntry_un2"] = cddlCountryName.dllListItemsValue;
            pnlEditSuccess.Visible = true;
        }
    }
}
